import UIKit

class ViewController3: UIViewController {
    
    // Lazy Initializers
    lazy var moveToNext: UIButton = {
        let button = UIButton(frame: CGRect(x: 100, y: 100, width: 44, height: 44))
        button.titleLabel?.font = UIFont.systemFont(ofSize: 16)
        button.setTitle("-", for: .normal)
        button.setTitleColor(.black, for: .normal)
        button.addTarget(self, action: #selector(goToPage), for: .touchUpInside)
        button.layer.cornerRadius = 22
        button.layer.masksToBounds = true
        button.layer.borderColor = UIColor.black.cgColor
        button.layer.borderWidth = 1.0
        return button
    }()
    
    @objc func goToPage()
    {
        self.navigationController?.pushViewController(ViewController(), animated: true)
    }
   
    // Lazy Initializers
    lazy var addBtn: UIButton = {
        let button = UIButton(frame: CGRect(x: 40, y: 100, width: 44, height: 44))
        button.titleLabel?.font = UIFont.systemFont(ofSize: 16)
        button.setTitle("＋", for: .normal)
        button.setTitleColor(.black, for: .normal)
        button.addTarget(self, action: #selector(addImageView(_:)), for: .touchUpInside)
        button.layer.cornerRadius = 22
        button.layer.masksToBounds = true
        button.layer.borderColor = UIColor.black.cgColor
        button.layer.borderWidth = 1.0
        return button
    }()


    lazy var templateEditContainer: TemplateEditContainer3 = {
        let v = TemplateEditContainer3(frame: view.bounds)
        return v
    }()
    

    override func viewDidLoad() {
        super.viewDidLoad()
        createSubview()
    
    }
    
    // Methods
    func createSubview() {
        view.backgroundColor = .white
        view.addSubview(templateEditContainer)

        view.addSubview(addBtn)
        view.addSubview(moveToNext)
        
       
        templateEditContainer.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }

    }
    
    // Event Handlers
    @objc func addImageView(_ btn: UIButton) {
        templateEditContainer.addTemplateImage()
        
    }
   
}
